﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media.Effects;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections;


namespace TouchUmlUI
{
    public class PopupMenuClass : PopupMenuBase
    {

        HoverButton delete;
        HoverButton cut;
        HoverButton copy;
        HoverButton select;
       

        public void copy_Click(object sender, MouseEventArgs e)
        {
            Window1.copyType = Window1.CopyType.COPY;
            windowParent.insertToClipboard(gUmlObj.umlobj,true);
        }

        public void selectInModel_Click(object sender, MouseEventArgs e)
        {
            windowParent.zaznaczWModelu(gUmlObj.obj_uml as Diagram.ElementNaDiagramie);
        }

        public void delete_Click(object sender, MouseEventArgs e)
        {
            gUmlObj.canvas.usunObiektUML(gUmlObj.umlobj);
        }

        public void cut_Click(object sender, MouseEventArgs e)
        {            
            copy_Click(sender, e);
            Window1.copyType = Window1.CopyType.CUT;
            delete_Click(sender, e);
        }

        public PopupMenuClass(int a_xPos, int a_yPos)
            : base(a_xPos, a_yPos, "Popup klasy")
        {
            delete = new HoverButton("ikony\\popupdelete.png","ikony\\popupdeletehover.png",46,46);
            copy = new HoverButton("ikony\\popupcopy.png","ikony\\popupcopyhover.png",46,46);
            cut = new HoverButton("ikony\\popupcut.png", "ikony\\popupcuthover.png", 46, 46);
            select = new HoverButton("ikony\\popupselect.png", "ikony\\popupselecthover.png", 46, 46);
            copy.MouseDown += copy_Click;
            select.MouseDown += selectInModel_Click;
            delete.MouseDown += delete_Click;
            cut.MouseDown += cut_Click;

            ToolTip deleteTP = new ToolTip();
            ToolTip copyTP = new ToolTip();
            ToolTip cutTP = new ToolTip();
            ToolTip selectTP = new ToolTip();
            deleteTP.Content = ToolTipPanel.createStackPanel("Usuń","Usuwa element z projektu");
            copyTP.Content = ToolTipPanel.createStackPanel("Kopiuj", "Kopiuje element do schowka");
            cutTP.Content = ToolTipPanel.createStackPanel("Wytnij", "Wycina element z modelu do schowka");
            selectTP.Content = ToolTipPanel.createStackPanel("Zaznacz w modelu", "Podświetla wybrany element w modelu tekstowym");
            delete.ToolTip = deleteTP;
            copy.ToolTip = copyTP;
            cut.ToolTip = cutTP;
            select.ToolTip = selectTP;



            AddHoverButton(delete);
            AddHoverButton(copy);
            AddHoverButton(cut);
            AddHoverButton(select);
            Show();
        }
    }
}
